package com.lagou.rpc.provider;

import com.lagou.rpc.provider.server.NettyServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class RpcProvider implements CommandLineRunner {

    @Autowired
    NettyServer nettyServer;

    public static void main(String[] args) {
        SpringApplication.run(RpcProvider.class,args);
    }

    @Override
    public void run(String... args) throws Exception {
        new Thread(()->{
            nettyServer.start("127.0.0.1",9999);
        }).start();

        new Thread(()->{
            nettyServer.start("127.0.0.1",8888);
        }).start();


        new Thread(()->{
            nettyServer.start("127.0.0.1",7777);
        }).start();
    }
}
